﻿using GetSmartIDEList.WebAPI.Common;
using GetSmartIDEList.WebAPI.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace GetSmartIDEList.WebAPI.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class MoveBackController : ControllerBase
    {
        //[HttpPost(template: "{name}")]
        [HttpPost]
        [AcceptVerbs("Post")]
        public IEnumerable<resultData> MoveBack([FromBody] string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return new[]
               {
                    new resultData { }
                };
            }
            else
            {
                //先移动
                ReposFunction.MoveBack(name);

                //再重新获取
                var lstData = CurrentListFunction.GetRightRepos();
                return lstData;
            }
        }
    }
}
